<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%--
  Created by IntelliJ IDEA.
  User: zhang_yao_wu1993
  Date: 15/4/21
  Time: 下午10:33
--%>
<!DOCTYPE html>
<html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <title>ZeRur</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="/Other/Lib/jquery-2.1.3.js"></script>
    <script type="text/javascript" src="/Other/Lib/SemanticUI/dist/semantic.min.js"></script>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/button.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/label.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/menu.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/list.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/item.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/comment.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/divider.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/image.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/sticky.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/form.min.css"/>
    <link rel="stylesheet" href="/Other/Lib/SemanticUI/dist/components/icon.min.css"/>
    <link rel="stylesheet" href="/Other/StyleSheet/blog_Message.css"/>
    <script type="text/javascript" src="/Other/JavaScript/blog_Message.js"></script>
</head>
<body style="background: RGBA(236, 236, 236, 1)">
<%-- header --%>
<div id="header">
    <sec:authorize access="hasAnyRole('ROLE_ADMIN','ROLE_USER')">
        <div class="ui divided horizontal list">
            <div class="item"><a href="javascript:void(0)">${blogMessagePageVo.loginStatusMessage}</a></div>
            <div class="item"><a href="/">欢迎页</a></div>
            <div class="item"><a href="/MainPage">主页</a></div>
            <div class="item"><a href="javascript:void(0)" style="color: white;">留言</a></div>
            <div class="item"><a href="/IndividualCenter">个人中心</a></div>
            <div class="item"><a href="/ManagePage">管理</a></div>
            <div class="item"><a onclick="logout()">登出</a></div>
            <form action="/j_logout" method="post">
                <input type="hidden"
                       name="${_csrf.parameterName}"
                       value="${_csrf.token}"/>
            </form>
            <script>
                function logout() {
                    $("#header div form").submit();
                }
            </script>
        </div>
    </sec:authorize>
    <sec:authorize access="isAnonymous()">
        <div class="ui divided horizontal list">
            <div class="item"><a href="javascript:void(0)">${blogMessagePageVo.loginStatusMessage}</a></div>
            <div class="item"><a href="/">欢迎页</a></div>
            <div class="item"><a href="/MainPage">主页</a></div>
            <div class="item"><a href="javascript:void(0)" style="color: white;">留言</a></div>
            <div class="item"><a href="/IndividualCenter">个人中心</a></div>
            <div class="item"><a href="/ManagePage">管理</a></div>
            <div class="item"><a href="/LoginPage">登陆</a></div>
            <div class="item"><a href="/RegisterPage">注册</a></div>
        </div>
    </sec:authorize>
</div>
<%-- end header --%>
<%-- body --%>
<div id="body">
    <%-- body_top --%>
    <div id="body_top">
        <a class="ui basic label">
            <iframe src="/MessageTitle" id="iframe" frameBorder="0" scrolling="no" width="100%" height="410px"></iframe>
        </a>
    </div>
    <%-- end body_top --%>
    <%-- comment_container --%>
    <div id="comment_container" class="ui label">
        <%-- comments --%>
        <div class="ui comments">
            <c:forEach items="${blogMessagePageVo.blogMessageList}" var="item">
                <div class="comment">
                    <a class="avatar">
                        <img src="${item.headerPath}">
                    </a>

                    <div class="content">
                        <a class="author">${item.creator}</a>

                        <div class="text">
                                ${item.commentContent}
                        </div>
                    </div>
                </div>
            </c:forEach>
        </div>
        <%-- end comments --%>
        <%-- pagination --%>
        <div id="pagination" class="ui pagination menu">
            <c:forEach items="${blogMessagePageVo.blogMessagePaginationList}" var="item">
                <a class="${item.active} item" href="${item.href}">
                    ${item.page}
                </a>
            </c:forEach>
        </div>
        <%-- end pagination --%>
        <hr/>
        <%-- login_box / comments_box --%>
        <sec:authorize access="hasAnyRole('ROLE_ADMIN','ROLE_USER')">
            <div id="comments_box" class="ui form">
                <form action="/LeavingMessage" method="post">
                    <div class="field">
                        <input type="text" name="message" maxlength="200">
                        <input type="hidden"
                               name="${_csrf.parameterName}"
                               value="${_csrf.token}"/>
                        <div id="submit_button" class="ui basic button mini">
                            <i class="comments icon"></i>
                            提交
                        </div>
                    </div>
                </form>
            </div>
        </sec:authorize>
        <sec:authorize access="isAnonymous()">
            <a href="/LoginPage">
                <div id="login_box" class="ui basic button mini">
                    <i class="icon user"></i>
                    请登陆发表评论
                </div>
            </a>
        </sec:authorize>
        <%-- end login_box / comments_box --%>
    </div>
    <%-- end comment_container --%>
</div>
<%-- end body --%>
<%-- footer --%>
<div id="footer">
    <span>zhang_yao_wu1993@yeah.net</span>
    <span>辽ICP备15003806号</span>
</div>
<%-- end footer --%>
<div class="clearboth"></div>
</body>
</html>
